# Name: [Verify Photos Page Links]
# By: [Wyatt Preul]
# [A simple test case for verifying all of the links and their values on the photos page]
# Maintenance:
#   [9/2//2006] : [WLP] : Created
#

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
require 'watir'
include Watir
require 'test/unit'
require '../watir.config.rb'

#_replace_Template_with_the_short_name_of_your_test_case
class TC_PhotosPage_test < Test::Unit::TestCase
      
      def startup			
        @@ie = Watir::IE.start($SITE_URL + 'photos/default.aspx')
      end
    
      def ie
        if defined? @@ie
          @@ie
        else
          startup
        end
      end
      
      def test_01_testLinksExist
       assert(ie.link(:url, $SITE_URL ).exists?)
        assert(ie.link(:text, 'Help').exists?)
        assert(ie.button(:id, /TitleBarSearchButton$/).exists?)
        assert(ie.link(:text, 'Home').exists?)
        assert(ie.link(:text, 'Blogs').exists?)
        assert(ie.link(:text, 'Forums').exists?)
        assert(ie.link(:text, 'Photos').exists?)
        assert(ie.link(:text, 'Downloads').exists?)
        assert(ie.link(:text, 'All Galleries').exists?)
        assert(ie.link(:text, 'Wildlife').exists?)
        assert(ie.link(:text, 'Browse All Tags').exists?)
      end
      
      def test_02_testLinksCorrect
        assert_equal $SITE_URL , ie.link(:text, 'Home').href
        assert_equal $SITE_URL + 'blogs/', ie.link(:text, 'Blogs').href
        assert_equal $SITE_URL + 'forums/', ie.link(:text, 'Forums').href
        assert_equal $SITE_URL + 'photos/', ie.link(:text, 'Photos').href
        assert_equal $SITE_URL + 'files/', ie.link(:text, 'Downloads').href
        assert_equal $SITE_URL + 'photos/gallerylisting.aspx', ie.link(:text, 'All Galleries').href
        assert_equal $SITE_URL + 'tags/Wildlife/default.aspx', ie.link(:text, 'Wildlife').href
        assert_equal $SITE_URL + 'tags/default.aspx', ie.link(:text, 'Browse All Tags').href
      end
      
      def test_99_closeIE
        ie.close
      end
end